import java.util.*;

class Solution {
    public int removeDuplicates(int[] nums) {
        if(nums.length == 1){
            return 1;
        }
        int left = 1;
        int tmp = nums[0];
        int right = 1;
        while(right < nums.length){
            if(nums[right] != tmp){
                tmp =nums[right++];
                nums[left++] = tmp;
            }else {
                right++;
            }
        }
        return left;
    }
}
public class Text {

    public static void main(String[] args) {

    }
}
